package xyz.twj;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

/**
 * 网关demo
 */
@SpringBootApplication
@Configuration
@ComponentScan
@EnableZuulProxy
@EnableEurekaClient
@EnableFeignClients
public class GatewayApp {
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(GatewayApp.class, args);
        Environment env = context.getEnvironment();
        String port = env.getProperty("server.port");
        String contextPath = env.getProperty("server.context-path");

        System.out.println("URL : http://127.0.0.1:" + port + contextPath);
    }
}
